const { override, addLessLoader, fixBabelImports, addWebpackAlias } = require('customize-cra')


const path = require('path')  // 导入path模块
function resolve(dir) {   // 返回绝对路径的方法
    return path.join(__dirname, '.', dir)
}

module.exports = override(
    addWebpackAlias({
        ["@"]: path.resolve(__dirname, "src")
    }),
    // 配置less相关信息
    addLessLoader({
        lessOptions:{
            javascriptEnabled: true,
            modifyVars: {
                // "@primary-color": "#777"
            }
        }
    }),
    // 按需引入   需要安装  npm i  babel-plugin-import -D
    fixBabelImports("import", {
        libraryName: "antd", 
        libraryDirectory: "es", 
        style: true    // change importing css to less
    })
)
